package com.general.box.knowledge;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.general.box.knowledge.model.BaseModel;

public class KnowledgeDetailActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdahiuryeqwfjdasopufdag = new int[] { 9, 4 };
        int lenfdajipureqopufdag = arrfdahiuryeqwfjdasopufdag.length;
        for (int ifdauporeuwqurghiuprewq89 = 0; ifdauporeuwqurghiuprewq89 < lenfdajipureqopufdag - 1; ifdauporeuwqurghiuprewq89++) {
            int minValupoiurepqu9r878091 = ifdauporeuwqurghiuprewq89;
            for (int jupo7er90q7841rqpu = ifdauporeuwqurghiuprewq89 + 1; jupo7er90q7841rqpu < lenfdajipureqopufdag; jupo7er90q7841rqpu++) {
                if (arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] > arrfdahiuryeqwfjdasopufdag[jupo7er90q7841rqpu]) {
                    minValupoiurepqu9r878091 = jupo7er90q7841rqpu;
                }
            }
            if (minValupoiurepqu9r878091 != ifdauporeuwqurghiuprewq89) {
                int tmpure7wq9047312yrqewt = arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89];
                arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89] = arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091];
                arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] = tmpure7wq9047312yrqewt;
            }
        }
        super.onCreate(savedInstanceState);
        setContentView(R.layout.ko_activity_knowledge_detail);
        findViewById(R.id.back).setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                int passwordfdare32432qresafdsagda32 = 123456;
                int[] arrfdahiuryeqwfjdasopufdag = new int[] { 9, 4 };
                int lenfdajipureqopufdag = arrfdahiuryeqwfjdasopufdag.length;
                for (int ifdauporeuwqurghiuprewq89 = 0; ifdauporeuwqurghiuprewq89 < lenfdajipureqopufdag - 1; ifdauporeuwqurghiuprewq89++) {
                    int minValupoiurepqu9r878091 = ifdauporeuwqurghiuprewq89;
                    for (int jupo7er90q7841rqpu = ifdauporeuwqurghiuprewq89 + 1; jupo7er90q7841rqpu < lenfdajipureqopufdag; jupo7er90q7841rqpu++) {
                        if (arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] > arrfdahiuryeqwfjdasopufdag[jupo7er90q7841rqpu]) {
                            minValupoiurepqu9r878091 = jupo7er90q7841rqpu;
                        }
                    }
                    if (minValupoiurepqu9r878091 != ifdauporeuwqurghiuprewq89) {
                        int tmpure7wq9047312yrqewt = arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89];
                        arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89] = arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091];
                        arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] = tmpure7wq9047312yrqewt;
                    }
                }
                finish();
            }
        });
        TextView tvTitle = findViewById(R.id.app_title_bar);
        TextView scTitle = findViewById(R.id.detail_sc_title);
        TextView scAuthor = findViewById(R.id.detail_sc_author);
        TextView scContent = findViewById(R.id.detail_sc_content);
        TextView scTranslation = findViewById(R.id.detail_sc_translation);
        LinearLayout knowledgeLayout = findViewById(R.id.knowledge_layout);
        TextView detail_content = findViewById(R.id.detail_content);
        LinearLayout teamLayout = findViewById(R.id.team_layout);
        TextView teamAddress = findViewById(R.id.detail_team_address);
        TextView teamIntro = findViewById(R.id.detail_team_intro);
        TextView teamRepresentative = findViewById(R.id.detail_team_representative);
        TextView includeTv = findViewById(R.id.detail_include_content);
        Intent intent = getIntent();
        BaseModel data = (BaseModel) intent.getSerializableExtra("data");
        int type = intent.getIntExtra("type", -1);
        if (data != null) {
            switch(type) {
                case 0:
                    scTitle.setText(data.getTitle());
                    tvTitle.setText(data.getTitle());
                    scAuthor.setText(data.getAuthor());
                    scContent.setText(data.getContent());
                    scTranslation.setText(data.getTranslation());
                    break;
                case // 花卉
                1:
                    knowledgeLayout.setVisibility(View.VISIBLE);
                    tvTitle.setText(data.getName());
                    detail_content.setText(data.getContent());
                    break;
                case // team
                2:
                    teamLayout.setVisibility(View.VISIBLE);
                    tvTitle.setText(data.getName());
                    teamAddress.setText(data.getSite());
                    teamIntro.setText(data.getIntro());
                    teamRepresentative.setText(data.getRepresentative());
                    break;
                case 3:
                    includeTv.setVisibility(View.VISIBLE);
                    includeTv.setText(data.getContent());
                    break;
            }
        }
    }
}
